@echo off
REM 设置源目录和目标目录
set "source_dir=01OBJ\Objects"
set "target_dir=./"

REM 检查目标目录是否存在，如果不存在则创建
if not exist "%target_dir%" (
  echo Target directory does not exist, creating...
  mkdir "%target_dir%"
)

REM 复制 .hex 文件
echo Copying .hex files from %source_dir% to %target_dir%
for %%f in ("%source_dir%\*.hex") do (
  copy "%%f" "%target_dir%"
  if errorlevel 1 (
    echo Failed to copy file: %%f
  ) else (
    echo Copied: %%f
  )
)

REM echo.
REM echo Operation completed.
exit
REM exit
REM pause